<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"  %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<title>首页</title>
		<script src="js/jquery-1.12.4.js"></script>
		<script type="text/javascript">
			$(function(){
				$("thead tr").not(":even").css("background-color","azure")
				$("tbody tr").not(":even").css("background-color","azure")
			});
		</script>
		<style type="text/css">
			#show{
				width: 700px;
				height: 500px;
				margin: 0px auto;
				text-align: center;
			}
			#show table{
				width: 650px;
				margin: 0px auto;
			}
			#show .title{
				font-size: 32px;
			}
		</style>
	</head>
	<body>
		<div id="show">
			<form action="Inquire" method="post">
				<p>
					新闻分类：
					<select name="classify">
						<option value="0" >全部</option>
						<c:forEach var="categorie" items="${categories}">
							<c:choose>
								<c:when test="categorie.id == id">
									<option selected="selected" value="${categorie.id}">${categorie.name }</option>
								</c:when>
								<c:otherwise>
									<option value="${categorie.id}">${categorie.name }</option>
								</c:otherwise>
							</c:choose>
						</c:forEach>
					</select>
					<input type="text" name="name" value="${name }" />
					<input type="submit" id="su" value="查询" />
				</p>
			</form>
			<table border="1">
				<thead>
					<tr class="title">
						<td colspan="6">新闻列表</td>
					</tr>
					<tr>
						<td>新闻编号</td>
						<td>新闻标题</td>
						<td>新闻摘要</td>
						<td>作者</td>
						<td>创建时间</td>
						<td>操作</td>
					</tr>
				</thead>
				<tbody>
					<c:forEach items="${details }" var="detail">
						<tr>
							<td>${detail.id }</td>
							<td>${detail.title }</td>
							<td>${detail.summary }</td>
							<td>${detail.author }</td>
							<td>
								<fmt:formatDate value="${detail.createdate }" pattern="yyyy-MM-dd HH:mm"/>
							</td>
							<td><a href="Update?id=${detail.id }">修改</a></td>
						</tr>
					</c:forEach>
				</tbody>
				
			</table>
		</div>
	</body>
</html>
